Conversation
waldekmastykarz
left a comment
There was a problem hiding this comment.
@copilot have you also considered supporting YAML in config files for plugins, like mocks, CRUD API, etc?
Yes, YAML is already supported for all plugin config files. The Users can specify YAML files for mocks, CRUD API definitions, error responses, rate limiting configs, and all other plugin-specific configuration files - they just need to use the |
There was a problem hiding this comment.
Pull request overview
Adds first-class YAML support for Dev Proxy configuration files so users can author configs in either JSON/JSONC or YAML (including anchors and merge keys), while keeping existing JSON configs working.
Changes:
- Added a YAML-to-JSON conversion utility (
ProxyYaml) and a YAMLIConfigurationProviderfor loading root config from.yaml/.yml. - Updated config file discovery/loading to recognize
devproxyrc.yaml/.ymland route through a newAddConfigFilehelper. - Updated sample config/mock detection to include YAML files when scanning downloaded config folders.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| DevProxy/Extensions/ConfigurationManagerExtensions.cs | Adds .yaml/.yml to devproxyrc discovery and uses AddConfigFile for JSON/YAML loading. |
| DevProxy/Commands/ConfigCommand.cs | Expands sample config/mock detection to include YAML files. |
| DevProxy.Abstractions/Utils/ProxyYaml.cs | Introduces YAML-to-JSON conversion with merge-key handling and scalar typing. |
| DevProxy.Abstractions/Plugins/BaseLoader.cs | Converts YAML plugin/mock files to JSON before schema validation and parsing. |
| DevProxy.Abstractions/Extensions/YamlConfigurationExtensions.cs | Adds YAML configuration source/provider and AddConfigFile extension method. |
DevProxy.Abstractions/Extensions/YamlConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
DevProxy.Abstractions/Extensions/YamlConfigurationExtensions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
… normalization - Handle nested merge keys recursively in CollectMergedValues instead of skipping them - Distinguish quoted empty strings from null using ScalarStyle in ProxyYaml - Normalize YAML 1.1 booleans (yes/no/on/off) to true/false in YamlConfigurationProvider
66b37c6 to
a0204d8
Compare
garrytrinder
left a comment
There was a problem hiding this comment.
Should we include an example default YAML configuration file alongside the existing devproxyrc.json file?
Good idea. It wouldn't be used, but it would be a good reference for folks. |
@copilot Add a YAML version of the default configuration (https://github.com/dotnet/dev-proxy/blob/main/DevProxy/devproxyrc.json and https://github.com/dotnet/dev-proxy/blob/main/DevProxy/devproxy-errors.json). Ensure, that both files are copied to the output on building and included in the installer. |
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Added in c02bc37:
Both files are copied to output on build and will be included in the installer automatically (since the installer copies all files from the build output directory). |
garrytrinder
left a comment
There was a problem hiding this comment.
We've got some issues with validation for files and plugins in YAML.
| # It demonstrates YAML features like comments, multiline strings, and anchors. | ||
|
|
||
| # Define reusable error body templates using YAML anchors | ||
| definitions: |


Adds YAML as an alternative to JSON for all configuration files. Supports YAML anchors and merge keys for reusable configuration blocks.
New Files
DevProxy.Abstractions/Utils/ProxyYaml.cs- YAML-to-JSON conversion with anchor/alias/merge key supportDevProxy.Abstractions/Extensions/YamlConfigurationExtensions.cs- ASP.NET CoreIConfigurationProviderfor YAML filesDevProxy/devproxyrc.yaml- YAML version of default configuration (reference example)DevProxy/devproxy-errors.yaml- YAML version of default error responses (reference example demonstrating anchors)Modified Files
ConfigurationManagerExtensions.cs- Addeddevproxyrc.yaml/.ymlto config file discoveryBaseLoader.cs- Convert YAML plugin configs to JSON before processingConfigCommand.cs- Detect YAML config/mock files in downloaded samplesDevProxy.csproj- Include YAML config files in build output and installerFeatures
.yamland.ymlextensions supported everywhere JSON is usedyes/no,on/off,true/false)Example
Backward compatible—existing JSON configuration continues to work unchanged.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.